﻿using System;
using System.Collections.Generic;
using ProtoBuf;
namespace PnJ.Aliyun.OTS.Models
{
    /// <summary>
    /// 读取指定主键范围内的数据
    /// </summary>
    [ProtoContract(Name = "GetRangeRequest")]
    public class GetRangeRequest
    {
        public GetRangeRequest()
        {

        }

        public GetRangeRequest(string tableName,Direction direction)
        {
            this.TableName = tableName;
            this.Direction = direction;
        }
        private List<string> columnsToGet = new List<string>();
        private List<Column> inclusiveStartPrimaryKey = new List<Column> ();
        private List<Column> exclusiveEndPrimaryKey = new List<Column> ();
        /// <summary>
        /// 要读取的数据所在的表名
        /// </summary>
        [ProtoMember(1, Name = "table_name",IsRequired =true)]
        public string TableName { get; set; }
        /// <summary>
        /// 本次查询的顺序
        /// </summary>
        [ProtoMember(2, Name = "direction", IsRequired =true)]
        public Direction Direction { get; set; }
        /// <summary>
        /// 需要返回的全部列的列名。若为空，则返回读取结果中每行的所有列
        /// </summary>
        [ProtoMember(3, Name = "columns_to_get")]
        public List<string> ColumnsToGet { get { return columnsToGet; } set { columnsToGet = value; } }
        /// <summary>
        ///本次读取最多返回的行数，若查询到的行数超过此值，则通过响应中包含的断点记录本次读取到的位置，以便下一次读取。此值必须大于0 
        /// </summary>
        [ProtoMember(4, Name = "limit")]
        public Int32 Limit { get; set; }
        /// <summary>
        /// 本次范围读取的起始主键，若该行存在，则响应中一定会包含此行
        /// </summary>
        [ProtoMember(5, Name = "inclusive_start_primary_key")]
        public List<Column> InclusiveStartPrimaryKey { get { return inclusiveStartPrimaryKey; } set { inclusiveStartPrimaryKey = value; } } // required all PKs, possibly filled with INF_MIN/INF_MAX
        /// <summary>
        /// 本次范围读取的终止主键，无论该行是否存在，响应中都不会包含此行
        /// </summary>
        [ProtoMember(6, Name = "exclusive_end_primary_key")]
        public List<Column> ExclusiveEndPrimaryKey { get { return exclusiveEndPrimaryKey; } set { exclusiveEndPrimaryKey = value; } } // required all PKs, possibly filled with INF_MIN/INF_MAX
    }
}
